import request from '@/utils/request'
// 获取组织架构信息
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}
// 获取公司信息
export function getCompanyById(id) {
  return request({
    url: `/company/${id}`,
    // 请求方法为 get 可以省略不写,默认值就是
    method: 'get'
  })
}
// 新增组织架构接口
export function addDepartments({ code, introduce, manager, name, pid }) {
  return request({
    url: '/company/department',
    method: 'post',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
export function getDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

// 编辑组织架构接口
export function changeDepartment({ code, introduce, manager, name, pid, id }) {
  return request({
    url: `/company/department/${id}`,
    method: 'put',
    data: {
      code,
      introduce,
      manager,
      name,
      pid
    }
  })
}
// 删除部门信息
export function deleteDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
